Skip to content

GH-2318: ReplyingKT - Wait for Assignment #2319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

garyrussell
Copy link
Contributor

Resolves #2318

Add an option to wait for assignment to the ReplyingKafkaTemplate; useful
when using auto.offset.reset=latest to avoid sending a request with the reply
sent before the container is initialized.

cherry-pick to 2.9.x, 2.8.x

Resolves spring-projects#2318

Add an option to wait for assignment to the `ReplyingKafkaTemplate`; useful
when using `auto.offset.reset=latest` to avoid sending a request with the reply
sent before the container is initialized.

**cherry-pick to 2.9.x, 2.8.x**
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How all of this is going to work when rebalance happens and new partitions are assigned to that replying contrainer, and we interact with this template at the moment?

Thanks

@garyrussell
Copy link
Contributor Author

With multiple application instances, you would generally not use group management, and manually assign partitions. Or, as mentioned in the documentation, each instance must have a different group.id. In either case, there will be no rebalances.

When you configure with a single reply TopicPartitionOffset, you can use the same reply topic for multiple templates, as long as each instance listens on a different partition. When configuring with a single reply topic, each instance must use a different group.id. In this case, all instances receive each reply, but only the instance that sent the request finds the correlation ID. This may be useful for auto-scaling, but with the overhead of additional network traffic and the small cost of discarding each unwanted reply. When you use this setting, we recommend that you set the template’s sharedReplyTopic to true, which reduces the logging level of unexpected replies to DEBUG instead of the default ERROR.

@artembilan artembilan merged commit f3215c8 into spring-projects:main Jun 23, 2022
@artembilan
Copy link
Member

... and cherry-picked to 2.9.x & 2.8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add A Mechanism To Wait For Manual Assignment to ReplyingKafkaTemplate
2 participants